<template>
  <div :class="['status-card',best?'best':'']">
    <div class="status-head">
      <span>TDCVD120</span>
      <div class="status">
        <span :class="[status === 0 ?'red':'',status!==2 && status!==0 ?'green':'yellow','statusbot']" />
        <em v-if="status === 1">开机</em>
        <em v-if="status === 0">关机</em>
        <em v-if="status === 2">待机</em>
      </div>

    </div>
    <div class="status-body">
      <div class="weektime runtime">
        <div class="hour">7.5h</div>
        <div class="hour-text">本周运行时间</div>
        <div class="img1 move1" />
        <div class="img2 move2" />
      </div>
      <div class="weektime sbtime">
        <div class="hour">7.5h</div>
        <div class="hour-text">本周待机时间</div>
        <div class="img1 move1" />
        <div class="img2 move2" />
      </div>
      <div class="weektime ldletime">
        <div class="hour">35h</div>
        <div class="hour-text">本周ldle时间</div>
        <div class="img1 move1" />
        <div class="img2 move2" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    currentData: {
      type: Object,
      default: () => {}
    },
    bestMachine: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      status: 1
    }
  },
  computed: {
    best() {
      return this.currentData.machine_id === this.bestMachine
    }
  }
}
</script>

<style lang="scss" scoped>
.status-card{
  width: 90%;
  height: 100%;
  background: url('~@assets/report/currentbg.png') no-repeat;
  background-size: 100% 100%;
  border-radius: 0.5rem;
  display: flex;
  flex-flow: column;
}
  .status-card.best{
    background: url('~@assets/report/currentbestbg.png') no-repeat;
  }
.status-head{
  width: 100%;
  height: 5rem;
  line-height: 5rem;
  border-bottom: 1px solid rgba(185,185,185,0.4);
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.status-head span{
  font-size: 1.4rem;
  font-weight: 600;
  color: #fff;
}
.status-head em{
  font-size: 1.5rem;
  font-weight: 600;
  font-style: normal;
  color: #fff;
}

.status-head .statusbot{
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 0.6rem;
  background: #bbb;
  margin: 0 0.8rem;
}
.status-head span.red{
  background: red;
}
.statu-heads span.green{
  background: #25df2e
}
.statu-heads span.yellow{
  background: #cfe031
}
.status-body{
  width: 100%;
  flex-basis: 66%;
  position: relative;
}
.weektime,.totaltime{
  display: flex;
  flex-flow: column nowrap;
  justify-content: center;
  align-content:center;

}
.totaltime{
  width: 8rem;
  height: 8rem;
  position: absolute;
  top: 22%;
  left: 60%;
}
.weektime{
  width: 9.5rem;
  height: 9.5rem;
  margin: 1rem;
  position: absolute;
  transform: translate(-50%, -50%);
}
.runtime{
  top: 47%;
  left: 16%;
}
.sbtime{
  top: 47%;
  left: 47%;
}
.ldletime{
  top: 47%;
  left: 78%;
}
.img1 {
  position: absolute;
  width: 100%;
  height: 100%;
  background: url('~@assets/report/bigcircle.png') no-repeat center center;
  background-size: 100% 100%;
}

.img2 {
position: absolute;
width: 100%;
height: 100%;
background: url('~@assets/report/smallcircle.png') no-repeat center center;
background-size: 88% 88%;
}

.move1 {
animation: myMove1 5s ease-in infinite alternate;
-webkit-animation: myMove1 5s ease-in infinite alternate;
}
.move2 {
animation: myMove2 3s ease infinite alternate;
-webkit-animation: myMove1 3s ease infinite alternate;
}

@keyframes myMove1 {
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}

@-webkit-keyframes myMove1 {
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}
@keyframes myMove2 {
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}

@-webkit-keyframes myMove2 {
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}
.hour{
  font-size: 1.8rem;
  color: #fff;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
}
.hour-text{
  font-size: 1rem;
  color: #ccc;
  text-align: center;
}
</style>
